FIND_PATH(CppUnit_INCLUDE_DIR NAMES cppunit
    HINTS
    $ENV{CPPUNITDIR}
    PATH_SUFFIXES include opencv
    PATHS
    /usr
    /usr/include
    /usr/include/cppunit
    /usr/local
    /usr/local/include
    /usr/local/include/cppunit
    /opt
    /opt/cppunit
)

SET(CppUnit_LIBRARIES)

IF(CppUnit_FIND_COMPONENTS)
    FOREACH(component ${CppUnit_FIND_COMPONENTS})
        FIND_LIBRARY(CppUnit_LIBRARY_${component} NAMES ${component}
            HINTS
            $ENV{CPPUNITDIR}
            PATH_SUFFIXES lib build/lib
            PATHS
            /usr
            /usr/lib
            /usr/lib/cppunit
            /usr/local
            /usr/local/lib
            /usr/local/lib/cppunit
            /opt
            /opt/cppunit
        )
        LIST(APPEND CppUnit_LIBRARIES ${CppUnit_LIBRARY_${component}})
    ENDFOREACH(component)
ENDIF(CppUnit_FIND_COMPONENTS)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CppUnit DEFAULT_MSG CppUnit_LIBRARIES CppUnit_INCLUDE_DIR)

IF(CPPUNIT_FOUND)
    SET(CppUnit_INCLUDE_DIRS ${CppUnit_INCLUDE_DIR})
ELSE(CPPUNIT_FOUND)
    SET(CppUnit_INCLUDE_DIRS)
ENDIF(CPPUNIT_FOUND)
